<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.util.ArrayList,
                 com.scalar.chiptrack.operations.process.VendorLocation,
                 com.scalar.chiptrack.operations.vendor.dao.VendorDAO,
                  com.scalar.chiptrack.utils.ConfigManager"%>

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-template.tld" prefix="template" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<chiptrack:checkLogon sourcePage="/waferStore.do"/>

<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>

<script src="<%=chipTracContext%>/jsp/includes/scripts/validations.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js"></script>
<script src="<%=chipTracContext%>/jsp/includes/scripts/wafer_process.js"></script>

<html:html locale="true">
<HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href='<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css' type='text/css' rel='stylesheet'>

<script language='javascript'>
    function back(){
       window.location = '<%=chipTracContext%>/processView.do?action=true&productID='+document.waferStoreForm.baseProductId.value;
    }
</script>
</HEAD>
<BODY bgColor='#ffffff' leftMargin='0' topMargin='0' marginheight='0' marginwidth='0' onLoad='javascript:whileLoad();'>

<!-- Top Header Start-->
<%@ include file="/jsp/includes/header.jsp" %>
<!-- Top Header End-->

<TABLE cellSpacing='0' cellPadding='0' width='100%' border='0'>
  <TBODY>
  <TR>
	<TD width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>

<!-- Side Navigation start -->
<%@ include file="/jsp/operations/operations_menu.jsp" %>
	</TD>
<!-- end of the side navigations -->

<TD bgcolor="#ffffff">
<IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
<TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
<TD valign="top" width="100%">

<IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
<BR>
<!-- from here your body starts -->

<center><span class="NArialW">Wafer Store</span></center>
<img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20>
<table  width="90%" border="0">
<tr>
<td align="left" class="NArialL" >
<strong><font color="FF0000"><font id="message"></font></font>
</td>
</tr>
</table><chiptrack:errors styleClass="NArialL"/>

<html:form name="waferStoreForm" type="com.scalar.chiptrack.operations.waferstore.forms.WaferStoreForm" action="/waferStore.do?action=save" >
<html:hidden name="waferStoreForm" property="baseProductId"/>
<html:hidden name="waferStoreForm" property="previousStepId"/>
<html:hidden name="waferStoreForm" property="trackID"/>
<html:hidden name="waferStoreForm" property="processStepId"/>
<html:hidden name="waferStoreForm" property="stepName"/>

   <table border='0' width='90%' align='right'>
        <tr>
          <td width="21%"><font class="NArialL">Product Name:</font><font color="RED" size="1"><B>*</B></font></td>
          <td width="28%"><font class="NArialL"><html:text name="waferStoreForm" property="productName" size="17" maxlength="50" styleClass="txfield"/></font><a href="javascript:addDupPartNumber('dupProductName','Product Name');" title='Click here to add duplicate Product Name'><img border=0 src='<%=chipTracContext%>/jsp/includes/images/add.jpg' height='15' width='20' align=center></a></td>
          <td width="5%">&nbsp;</font></td>
          <td width="18%">&nbsp;</td>
          <td width="37%">&nbsp;</td>
        </tr>
		<logic:iterate name="waferStoreForm" property="dupProductName" id="xxxx">
			<tr>
				<td width="21%"><font class="NArialL"><font color=green>Product Name:</font></font></td>
				<td width="28%" align="left">
					<input type="text" name="dupProductName" value="<%=xxxx%>" class=txfield size="17" maxlength="50" >
				</td>
			</tr>
		</logic:iterate>
		<tr>
			<td colspan='5'><font id="font1"></font></td>
		</tr>
        <tr>
          <td width="21%"><font class="NArialL">Min Level:</font></td>
          <td width="28%"><html:text name="waferStoreForm" property="minLevel" size="17" maxlength="50" styleClass="txfield"/></td> 
          <td width="5%">&nbsp;</font></td>
          <td width="18%"><font class="NArialL">Max Level:</font></td>
          <td width="37%"><html:text name="waferStoreForm" property="maxLevel" size="17" maxlength="50" styleClass="txfield"/></td>
        </tr>
        <tr>
          <td width="21%"><font class="NArialL">Max Time:</font></td>
          <td width="28%"><html:text name="waferStoreForm" property="maxTime" size="17" maxlength="50" styleClass="txfield"/></td>
          <td width="5%">&nbsp;</font></td>
          <td width="18%"><font class="NArialL">Comments:</font></td>
          <td width="37%"><html:textarea name="waferStoreForm" rows="4" property="comments" cols="23" styleClass="txfield"/></td>
        </tr>
        <tr><td colspan=5><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=25></td></tr>

    <tr><td colspan='5' class="NArialL">
        <table width="60%" border=0 bordercolor="#FFFFFF">
            <tr><td class="NArialL" colspan=9 width="477" height="18">Vendor Location Information&nbsp;:&nbsp;</td></tr>

            <tr>
                <td width="10%" align="center" bgcolor="#993333" height="1"><font class="NArialL"><font color="#FFFFFF">Select</font></td>
                <td width="10%" align="center" bgcolor="#993333" height="1"><font class="NArialL"><font color="#FFFFFF">Priority</font></td>
                <td width="80%" align="center" bgcolor="#993333" height="1"><font class="NArialL"><font color="#FFFFFF">Location</font></font></td>
            </tr>

            <%
                ArrayList vendorLocations = (ArrayList) request.getAttribute("vendorLocations");

                if (vendorLocations == null) vendorLocations = new ArrayList();
                int size = vendorLocations.size();
                VendorLocation location = null;
                int locationId = -1;
                String priority = null;
                String locationSelected = "off";
                String locationName = "";

                for (int i=0; i<size; i++) {
                    location = (VendorLocation) vendorLocations.get(i);
                    priority = location.getPriority();
                    locationId = location.getLocationIDAsInt();
                    locationName = location.getLocationName();
                    locationSelected = location.getSelect();
            %>
                <tr>
                    <td width="20%" align="center" bgcolor="#DEE1E2" height="1"><font class="NArialL"><font color="#FFFFFF"><input type='checkbox' name='<%="select_"+i%>' <%if ((locationSelected != null) && (locationSelected.trim().length() != 0)) out.print ("checked");%>  class='txfield' onclick="checkLocation(<%=i%>,'select_')" value='off'/></font></td>
                    <td width="20%" align="center" bgcolor="#DEE1E2" height="1"><font class="NArialL"><font color="#FFFFFF"><input type=text name='priority' size="6" disabled="true" value='<%if (priority != null) out.print (priority);%>' class="txfield" /></font></td>
                    <td width="60%" align="center" bgcolor="#DEE1E2" height="1"><font class="NArialL"><font color="#FFFFFF">
                        <input type="text" name="locationName" value='<%=locationName%>' size='40' disabled="true" class="txfield" />
                        <input type="hidden" name="locationID" value='<%=locationId%>' size='40' class="txfield" />
                    </font></font></td>
                </tr>
            <%

                }
            %>

        </table>
		<input type="hidden" name="count" value="<%=size%>" >
    </td></tr>


       <tr><td colspan=5><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=15></td></tr>
       <tr><td colspan=5>
       </td></tr>
           <tr><td colspan=5>&nbsp;</td></tr>
           <tr><td align=center colspan=5>
               <!--a href="<%=chipTracContext%>/test.do"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/back.gif" width="39" height="17"></a-->
               <chiptrack:restrictedLink functionality='<%=Functionality.PRODUCT_SETUP%>' action='<%=User.USER_ACTION_MODIFY%>' href='javascript:back();' onmouseover="window.status='Click here to go back to Process View';return true" onmouseout="window.status='';return true">
                <img border='0' src='<%=chipTracContext%>/jsp/includes/images/back.gif'></chiptrack:restrictedLink></a>
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
               <!--a href="javascript:saveWaferStore()"><img border="0" src="<%=chipTracContext%>/jsp/includes/images/next.gif" width="53" height="17"></a-->
               <chiptrack:restrictedLink functionality='<%=Functionality.PRODUCT_SETUP%>' action='<%=User.USER_ACTION_MODIFY%>' href='javascript:saveWaferStore();' onmouseover="window.status='Click here to save this WaferStore';return true" onmouseout="window.status='';return true">
                <img border='0' src='<%=chipTracContext%>/jsp/includes/images/next.gif'></chiptrack:restrictedLink>
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
           </td></tr>
       </table>
</html:form>
<!-- till here -->
<BR><BR><BR></TD>
<TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
</TR>
</TABLE>
<!-- Footer starts here -->
<%@ include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->
</body>
</html:html>